# import json
# from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
#
#
# import requests
#
#
# def login(inData):
#     # 1-url
#     url = 'http://116.246.19.245:13000/api/website/web/webLogin/login.do'
#     header = {'Content-Type': 'application/json'}
#     payload = json.dumps(inData)
#     resp = requests.post(url, headers=header, data=payload)
#     print(resp.headers.get('Set-Cookie'))
#     # print(type(resp.headers))
#     # print(resp.headers)
#
#     # print(resp)
#
# login({
#   "userName": "13301922191",
#   "password": "e10adc3949ba59abbe56e057f20f883e"
# })
#
# """
# {
# 'Set-Cookie': 'auth_website=eyJhbGciOiJIUzI1NiJ9.eyJ3d3cuaGFwcHkuY29tIjoiYX
# V0aF93ZWJzaXRlOjEzMzg0MTY0ODc0NjIzODc3MTQ6ZWU2NzM4N2VhNjNhNDZkNmFlMmQ1M2UwZDcz
# NzcyNGEiLCJleHAiOjM3OTM3ODQzNDF9.6KX0biglzid9b9_NC3Rg6bgucbApx7xG8pvNt8kIAE8;
#
# Max-Age=60000; Expires=Fri, 04-Mar-2022 02:24:54 GMT; Path=/, %2Fweb_userName=13301922191; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT, %2Fweb_password=e10adc3949ba59abbe56e057f20f883e; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT, dubbo.env=portal-okd-test|dzg-orgbase&wwl-membership;Path=/;'}
#
# """
#
#


# from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
# from meiduo_mall import settings
#
#
# def generic_email_verify_token(user_id):
#     # 1. 创建实例
#     s = Serializer(secret_key=settings.SECRET_KEY, expires_in=3600 * 24)
#     # 2. 加密数据
#     data = s.dumps({'user_id': user_id})
#     # 3. 返回数据
#     print(data)
#     print(data.decode())
#     return data.decode()
#
#
# def check_verify_token(token):
#     # 1.创建实例
#     s = Serializer(secret_key=settings.SECRET_KEY, expires_in=3600 * 24)
#     # 2.解密数据--可能有异常
#     try:
#         result = s.loads(token)
#     except Exception as e:
#         return None
#     # 3.获取数据
#     print(result)
#     print(result.get('user_id'))
#     # result = {'user_id':user_id}
#     return result.get('user_id')
#
#
# if __name__ == '__main__':
#     a = generic_email_verify_token(2)
#     check_verify_token(a)


# print(li)
#
# li2 = [i*10 for i in range(1, 10) if i % 2 == 0]
# print(li2)
#
# li3 = [i*100 if i % 3 == 0 else i*10 for i in range(1, 10)]
import base64
import pickle

dict_data = {'1': {'count': 10, 'selected': True}, '2': {'count': 20, 'selected': False}}
byte_data = pickle.dumps(dict_data)
print(byte_data)
# dict_data2 = pickle.loads(byte_data)
# print(dict_data2)
ba1 = base64.b64encode(dict_data)
print(str(ba1))